package com.whut.report;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.whut.model.*;
import com.whut.parMapper.ParProblemCollectDetailMapper;
import com.whut.parMapper.ParProblemDescriptionMapper;
import com.whut.parMapper.ParSystemMapper;
import com.whut.parMapper.utils.MapperUtils;
import com.whut.service.impl.CheckInfoServiceImpl;
import com.whut.service.impl.ReportServiceImpl;
import com.whut.utils.FileUtil;
import com.whut.utils.HttpUtil;
import com.whut.utils.MDoc;
import com.whut.utils.pointsCalculate;
import com.whut.v_model.ProblemCollectDetail;
import org.apache.commons.lang3.StringUtils;

import javax.annotation.Resource;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;

public class VisualizationReport2 {

    @Resource
    private UrlProperties urlProperties;
    @Resource
    private Profiles profiles;
    private ParSystemMapper parSystemMapper;
    private ParProblemDescriptionMapper parProblemDescriptionMapper;
    private ParProblemCollectDetailMapper parProblemCollectDetailMapper;
    private ReportServiceImpl reportServiceImpl;


    private MapperUtils mapperUtils;

    private int checkId;
    private int projectId;
    private boolean isNew;
    public static final int WIDTH = 718;
    public static final int HEIGHT = 468;
    public VisualizationReport2(ParSystemMapper parSystemMapper,
                                ParProblemDescriptionMapper parProblemDescriptionMapper,
                                ParProblemCollectDetailMapper parProblemCollectDetailMapper,
                                ReportServiceImpl reportServiceImpl,
                                MapperUtils mapperUtils,
                                UrlProperties urlProperties,
                                Profiles profiles
    ) {
        this.parSystemMapper = parSystemMapper;
        this.parProblemDescriptionMapper = parProblemDescriptionMapper;
        this.parProblemCollectDetailMapper = parProblemCollectDetailMapper;
        this.reportServiceImpl = reportServiceImpl;
        this.mapperUtils=mapperUtils;
        this.urlProperties=urlProperties;
        this.urlProperties=urlProperties;
        this.profiles=profiles;
    }

    public String getVisualizationReport2(int checkId, int projectId) throws UnsupportedEncodingException {
        DecimalFormat df = new DecimalFormat("0.00");
        Map<String, Object> dataMap = new HashMap<String, Object>();

        reportServiceImpl.initWordDate(dataMap);

        List<String> type3List = new ArrayList<String>();
        type3List.add("2");
        type3List.add("3");
        type3List.add("4");
        //工程概况部分，来自ctp的工程信息
        reportServiceImpl.initProjectSummaryFirstPart(projectId, dataMap);

        //项目质量隐患分布/*/                                                                                                                                                                                                                   */
        int allProblemNum = parProblemCollectDetailMapper.getAllNum(checkId);
        int txNum = parProblemCollectDetailMapper.getAllRiskPointCountByType(checkId, "提醒");
        int oneNum = parProblemCollectDetailMapper.getAllRiskPointCountByType(checkId, "1");
        int twoNum = parProblemCollectDetailMapper.getAllRiskPointCountByType(checkId, "2");
        int threeNum = parProblemCollectDetailMapper.getAllRiskPointCountByType(checkId, "3");
        int fourNum = parProblemCollectDetailMapper.getAllRiskPointCountByType(checkId, "4");
        dataMap.put("txNum", txNum);
        dataMap.put("oneNum", oneNum);
        dataMap.put("twoNum", twoNum);
        dataMap.put("threeNum", threeNum);
        dataMap.put("fourNum", fourNum);
        String txPercent = pointsCalculate.caculateToPercent(txNum, allProblemNum);
        String onePercent = pointsCalculate.caculateToPercent(oneNum, allProblemNum);
        String twoPercent = pointsCalculate.caculateToPercent(twoNum, allProblemNum);
        String threePercent = pointsCalculate.caculateToPercent(threeNum, allProblemNum);
        String fourPercent = pointsCalculate.caculateToPercent(fourNum, allProblemNum);
        dataMap.put("txPercent", txPercent);
        dataMap.put("onePercent", onePercent);
        dataMap.put("twoPercent", twoPercent);
        dataMap.put("threePercent", threePercent);
        dataMap.put("fourPercent", fourPercent);
        dataMap.put("allProblemNum", allProblemNum);
        try {
            HashMap<String, String> riskPieMap = new HashMap<>();
            Map<String, Object> riskPieMaps = new HashMap<>();
            Map<String, Object> riskPieMap0 = new HashMap<>();
            riskPieMap0.put("name", "提醒");
            riskPieMap0.put("y", txNum);
            riskPieMap0.put("sliced", true);
            riskPieMap0.put("color", "rgb(46,232,65)");
            Map<String, Object> riskPieMap1 = new HashMap<>();
            riskPieMap1.put("name", "特征值1");
            riskPieMap1.put("y", oneNum);
            riskPieMap1.put("sliced", true);
            riskPieMap1.put("color", "rgb(49，95，232)");
            Map<String, Object> riskPieMap2 = new HashMap<>();
            riskPieMap2.put("name", "特征值2");
            riskPieMap2.put("y", twoNum);
            riskPieMap2.put("sliced", true);
            riskPieMap2.put("color", "rgb(232,232,232)");
            Map<String, Object> riskPieMap3 = new HashMap<>();
            riskPieMap3.put("name", "特征值3");
            riskPieMap3.put("y", threeNum);
            riskPieMap3.put("sliced", true);
            riskPieMap3.put("color", "rgb(240,117,60)");
            Map<String, Object> riskPieMap4 = new HashMap<>();
            riskPieMap4.put("name", "特征值4");
            riskPieMap4.put("y", fourNum);
            riskPieMap4.put("sliced", true);
            riskPieMap4.put("color", "rgb(232,36,18)");
            Object[] riskPieInfo = new Object[]{riskPieMap0, riskPieMap1, riskPieMap2, riskPieMap3, riskPieMap4};
            riskPieMaps.put("data", riskPieInfo);
            riskPieMaps.put("title", "项目质量隐患分布饼图");
            riskPieMap.put("dataSet", JSON.toJSONString(riskPieMaps));
            riskPieMap.put("width", "718");
            riskPieMap.put("height", "468");
            riskPieMap.put("index", "2");
            String riskPiePic = HttpUtil.post("http://localhost:3000/highcharts", riskPieMap, "utf-8");
            dataMap.put("riskPiePic", riskPiePic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        try {
            HashMap<String, String> riskBarMap = new HashMap<>();
            Map<String, Object> riskBarInfos = new HashMap<>();
            Map<String, Object> riskBarInfo0 = new HashMap<>();
            riskBarInfo0.put("name", "提醒");
            riskBarInfo0.put("color", "rgb(46,232,65)");
            riskBarInfo0.put("data", new Integer[]{txNum});
            Map<String, Object> riskBarInfo1 = new HashMap<>();
            riskBarInfo1.put("name", "特征值1");
            riskBarInfo1.put("color", "rgb(49,95,232)");
            riskBarInfo1.put("data", new Integer[]{oneNum});
            Map<String, Object> riskBarInfo2 = new HashMap<>();
            riskBarInfo2.put("name", "特征值2");
            riskBarInfo2.put("color", "rgb(232,232,49)");
            riskBarInfo2.put("data", new Integer[]{twoNum});
            Map<String, Object> riskBarInfo3 = new HashMap<>();
            riskBarInfo3.put("name", "特征值3");
            riskBarInfo3.put("color", "rgb(240,117,60)");
            riskBarInfo3.put("data", new Integer[]{threeNum});
            Map<String, Object> riskBarInfo4 = new HashMap<>();
            riskBarInfo4.put("name", "特征值4");
            riskBarInfo4.put("color", "rgb(232,36,18)");
            riskBarInfo4.put("data", new Integer[]{fourNum});
            Object[] riskBarInfo = new Object[]{riskBarInfo0, riskBarInfo1, riskBarInfo2, riskBarInfo3, riskBarInfo4};
            riskBarInfos.put("series", riskBarInfo);
            riskBarInfos.put("title", "项目质量隐患分布直方图");
            riskBarMap.put("dataSet", JSON.toJSONString(riskBarInfos));
            riskBarMap.put("width", "718");
            riskBarMap.put("height", "468");
            riskBarMap.put("index", "3");
            String riskBarPic = HttpUtil.post("http://localhost:3000/highcharts", riskBarMap, "utf-8");
            dataMap.put("riskBarPic", riskBarPic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        //实测实量分项结果
        List<String> scslBarCategories = new ArrayList<>();
        List<Double> scslBarData0 = new ArrayList<>();
        int scslNum = mapperUtils.getMeasuretablerecordMapper().getAllNumByCheckId(checkId);
        dataMap.put("scslNum", scslNum);
        int scslQuaNum = mapperUtils.getMeasuretablerecordMapper().getAllQuaNumByCheckId(checkId);
        String scslPoint = pointsCalculate.caculateToPercent(scslQuaNum, scslNum);
        dataMap.put("scslPoint", scslPoint);
        List<Measuretablerecord> measuretablerecords = mapperUtils.getMeasuretablerecordMapper().getTableData(checkId);
        List<Object> scslList = new ArrayList<>();
        if (scslNum == 0) {
            Map<String, Object> scslMap = new HashMap<>();
            scslMap.put("no", "/");
            scslMap.put("pName3", "/");
            scslMap.put("pName4", "/");
            scslBarCategories.add("未测量");
            scslMap.put("totalQualifiedRate", "/");
            scslBarData0.add(0.0);
            scslMap.put("reserve1", "/");
            scslMap.put("remark", "/");
            scslList.add(scslMap);
        } else {
            for (int i = 0; i < measuretablerecords.size(); i++) {
                Map<String, Object> scslMap = new HashMap<>();
                scslMap.put("no", i + 1);
                scslMap.put("pName3", measuretablerecords.get(i).getReserve2() == null ? "" : measuretablerecords.get(i).getReserve2());
                scslMap.put("pName4", measuretablerecords.get(i).getMeasureTableName());
                scslBarCategories.add(measuretablerecords.get(i).getMeasureTableName());
                scslMap.put("totalQualifiedRate", measuretablerecords.get(i).getTotalQualifiedRate());
                scslBarData0.add(pointsCalculate.getPercentInstance(measuretablerecords.get(i).getTotalQualifiedRate()));
                scslMap.put("reserve1", measuretablerecords.get(i).getReserve1() == null ? "" : measuretablerecords.get(i).getReserve1());
                scslMap.put("remark", measuretablerecords.get(i).getMeasureTableName() + "共实测" + measuretablerecords.get(i).getTotalPointNumber() + "个点,其中" + (measuretablerecords.get(i).getTotalPointNumber() - measuretablerecords.get(i).getQualifiedPointNumber()) + "个点不合格。");
                scslList.add(scslMap);
            }
        }
        //实测实量合格率直方图
        try {
            HashMap<String, String> scslBarMap = new HashMap<>();
            Map<String, Object> scslBarInfos = new HashMap<>();
            Map<String, Object> scslBarInfo0 = new HashMap<>();
            scslBarInfo0.put("name", "合格率");
            scslBarInfo0.put("color", "rgb(49,95,232)");
            scslBarInfo0.put("data", scslBarData0);
            Object[] scslBarInfo = new Object[]{scslBarInfo0};
            scslBarInfos.put("series", scslBarInfo);
            scslBarInfos.put("categories", scslBarCategories);
            scslBarInfos.put("title", "实测实量合格率直方图");
            scslBarMap.put("dataSet", JSON.toJSONString(scslBarInfos));
            scslBarMap.put("width", "718");
            scslBarMap.put("height", "468");
            scslBarMap.put("index", "6");
            String scslBarPic = HttpUtil.post("http://localhost:3000/highcharts", scslBarMap, "utf-8");
            dataMap.put("scslBarPic", scslBarPic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        //分数计算
        Integer taskId = mapperUtils.getContractchecktaskMapper().getTaskIdByCheckId(checkId);
        List<ProblemCollectDetail> thirdIdProblemDetail = parProblemCollectDetailMapper.getAllThirdInfoMXTQ(checkId);
        for (int i = 0; i < thirdIdProblemDetail.size(); i++) {
            double point3 = 0;
            int thirdId = thirdIdProblemDetail.get(i).getThirdId();
            List<ProblemCollectDetail> fourthIdProblemDetail = parProblemCollectDetailMapper.getAllFourthInfoMXTQ(checkId, thirdId);
            String fourthCalculateInfo = JSON.toJSONString(fourthIdProblemDetail, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
            JSONArray fourthPointsCalculateArray = JSONArray.parseArray(fourthCalculateInfo);
           /* double allweight4 = 0;
            for (int v = 0; v < fourthPointsCalculateArray.size(); v++) {
                JSONObject jsonObject = fourthPointsCalculateArray.getJSONObject(v);
                double Tweight4 = 0;
                int fourthId = jsonObject.getIntValue("fourthId");
                String trueweight4 = parSystemMapper.getWeight3ByThirdId(fourthId);
                Tweight4 = pointsCalculate.getPercentInstance(trueweight4);
                allweight4 += Tweight4;
            }*/
            for (int j = 0; j < fourthPointsCalculateArray.size(); j++) {
                JSONObject part2InnerObject = fourthPointsCalculateArray.getJSONObject(j);
                double allweight4 = 0;
                List<ProblemCollectDetail> countFourthWeight = parProblemCollectDetailMapper.getAllFourthInfoMXTQ(checkId, part2InnerObject.getIntValue("thirdId"));
                for (int v = 0; v < countFourthWeight.size(); v++) {
                    double Tweight4 = 0;
                    int fourthId = countFourthWeight.get(v).getFourthId();
                    String newWeight4 = mapperUtils.getEditableweightpsMapper().getWeightByNumber(fourthId, taskId);
                    if (StringUtils.isNotBlank(newWeight4)) {
                        Tweight4 = pointsCalculate.getPercentInstance(newWeight4);
                    } else {
                        String trueweight4 = parSystemMapper.getWeight3ByThirdId(fourthId);
                        Tweight4 = pointsCalculate.getPercentInstance(trueweight4);
                    }
                    allweight4 += Tweight4;
                }
                double weight3 = 0;
                double weight4 = 0;
                int part2FourthId = part2InnerObject.getIntValue("fourthId");
                int part2ThirdId = part2InnerObject.getIntValue("thirdId");
                //更改权重来源
                String newWeight44 = mapperUtils.getEditableweightpsMapper().getWeightByNumber(part2FourthId, taskId);
                if (StringUtils.isNotBlank(newWeight44)) {
                    weight4 = pointsCalculate.getPercentInstance(newWeight44);
                } else {
                    weight4 = pointsCalculate.getPercentInstance(part2InnerObject.getString("weight4"));
                }

                String newWeight33 = mapperUtils.getEditableweightpsMapper().getWeightByNumber(part2ThirdId, taskId);
                if (StringUtils.isNotBlank(newWeight33)) {
                    weight3 = pointsCalculate.getPercentInstance(newWeight33);
                } else {
                    weight3 = pointsCalculate.getPercentInstance(part2InnerObject.getString("weight3"));
                }

                List<ProblemCollectDetail> sixthPoints = parProblemCollectDetailMapper.getsixthPoints(checkId, part2FourthId);
                String pointName6Info = JSON.toJSONString(sixthPoints, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray sixthPointsArray = JSONArray.parseArray(pointName6Info);
                double calculatePoint6 = 0;
                double calculatePoint66 = 0;
                double calculateTruePoint = 0;
                List<Object> allSixthList = new ArrayList<>();
                for (int y = 0; y < sixthPointsArray.size(); y++) {
                    Map<String, Object> allSixMap = new HashMap<>();
                    JSONObject sixPointObject = sixthPointsArray.getJSONObject(y);
                    allSixMap.put("pName6", sixPointObject.getString("pName6"));
                    int deductSixthId = sixPointObject.getIntValue("sixthId");
                    float deductPointsSumFloat = parProblemCollectDetailMapper.getdeductSum(checkId, deductSixthId);
                    double deductPointsSum = Double.valueOf(String.valueOf(deductPointsSumFloat));
                    double truePoint = Double.parseDouble(sixPointObject.getString("point6"));
                    allSixMap.put("duePoint", truePoint);
                    allSixMap.put("deductPoint", deductPointsSum);
                    allSixthList.add(allSixMap);
                    if (truePoint <= deductPointsSum) {
                        calculatePoint66 = 0;
                    } else {
                        calculatePoint66 = truePoint - deductPointsSum;
                    }
                    calculateTruePoint += truePoint;
                    calculatePoint6 += calculatePoint66;
                }
                double noProblemPoint = 0;
                List<Object> noProblemSixthIdList = mapperUtils.getUncheckeditemsMapper().getNoProblemSixthId(checkId, part2InnerObject.getIntValue("fourthId"));
                String noProblemSixthIdInfo = JSON.toJSONString(noProblemSixthIdList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray noProblemSixthArray = JSONArray.parseArray(noProblemSixthIdInfo);
                for (int m = 0; m < noProblemSixthArray.size(); m++) {
                    Map<String, Object> allSixMap = new HashMap<>();
                    int noProblemSixthId = noProblemSixthArray.getIntValue(m);
                    allSixMap.put("pName6", parSystemMapper.getName4ByName4Id(noProblemSixthId));
                    allSixMap.put("duePoint", parSystemMapper.getPoint4ByPoint4Id(noProblemSixthId));
                    allSixMap.put("deductPoint", 0);
                    allSixthList.add(allSixMap);
                    double noProblem = Double.parseDouble(parSystemMapper.getPoint4ByPoint4Id(noProblemSixthId));
                    noProblemPoint += noProblem;
                }
                List<Integer> wsjList = parSystemMapper.getWSJList(checkId, part2InnerObject.getIntValue("fourthId"));
                for (int g = 0; g < wsjList.size(); g++) {
                    Map<String, Object> allSixMap = new HashMap<>();
                    int wsjSixthId = wsjList.get(g);
                    allSixMap.put("pName6", parSystemMapper.getName4ByName4Id(wsjSixthId));
                    allSixMap.put("duePoint", parSystemMapper.getPoint4ByPoint4Id(wsjSixthId));
                    allSixMap.put("deductPoint", "未涉及");
                    allSixthList.add(allSixMap);
                }
                System.out.println("第六级扣过的分数总分:" + calculatePoint6 + "没有问题的总分:" + noProblemPoint + "第六级总分:" + calculateTruePoint);
                double checkItemPoint = (calculatePoint6 + noProblemPoint) / (calculateTruePoint + noProblemPoint) * 100;
                point3 += checkItemPoint * (weight4 / allweight4);
                List<ProblemCollectDetail> checkItemCalcuList = parProblemCollectDetailMapper.getAllFourthInfo(checkId, part2FourthId);
                String maxFourthRiskPoint = pointsCalculate.getMaxRiskPoint(checkItemCalcuList);
                int maxFourthRiskPointNum = parProblemCollectDetailMapper.getRiskPointCount(checkId, part2FourthId, maxFourthRiskPoint);
                double limitFourhPoint = Double.parseDouble((mapperUtils.getPointlimitMapper().getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint)) == null ? "100" : mapperUtils.getPointlimitMapper().getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint));
                if (checkItemPoint > limitFourhPoint) {
                    checkItemPoint = limitFourhPoint;
                }
                String s = df.format(checkItemPoint);
                int allPointSaveFourthPointCount = mapperUtils.getAllpointsaveMapper().getAllPointCountByCheckId(checkId, part2FourthId);
                if (allPointSaveFourthPointCount != 0) {
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
                    Date date1 = new Date(System.currentTimeMillis());
                    String lastEditTime = formatter.format(date1);
                    mapperUtils.getAllpointsaveMapper().updateAllPoint(checkId, s, part2FourthId, lastEditTime);
                } else {
                    Allpointsave allpointsave = new Allpointsave();
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
                    Date date1 = new Date(System.currentTimeMillis());
                    allpointsave.setNewCreateTime(formatter.format(date1));
                    allpointsave.setLastEditTime(formatter.format(date1));
                    allpointsave.setProjectId(projectId);
                    allpointsave.setCheckId(checkId);
                    allpointsave.setNumber(part2FourthId);
                    allpointsave.setPoint(s);
                    mapperUtils.getAllpointsaveMapper().insert(allpointsave);
                }
            }
            String t = df.format(point3);
            int allPointSaveThirdPointCount = mapperUtils.getAllpointsaveMapper().getAllPointCountByCheckId(checkId, thirdId);
            if (allPointSaveThirdPointCount != 0) {
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
                Date date1 = new Date(System.currentTimeMillis());
                String lastEditTime = formatter.format(date1);
                mapperUtils.getAllpointsaveMapper().updateAllPoint(checkId, t, thirdId, lastEditTime);
            } else {
                Allpointsave allpointsave = new Allpointsave();
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
                Date date1 = new Date(System.currentTimeMillis());
                allpointsave.setNewCreateTime(formatter.format(date1));
                allpointsave.setLastEditTime(formatter.format(date1));
                allpointsave.setProjectId(projectId);
                allpointsave.setCheckId(checkId);
                allpointsave.setNumber(thirdId);
                allpointsave.setPoint(t);
                mapperUtils.getAllpointsaveMapper().insert(allpointsave);
            }
        }

        //质量隐患评估总体情况以及分项情况
        List<String> zlResultBarCategories = new ArrayList<>();
        List<Integer> zlResultBarData0 = new ArrayList<>();
        List<Integer> zlResultBarData1 = new ArrayList<>();
        List<Double> zlResultBarData2 = new ArrayList<>();

        List<Integer> allZLThirdIdList = parProblemCollectDetailMapper.getAllThirdIdByFirstId(checkId, 628);
        double allZLweight3 = 0;
        double zlPoint = 0;
        for (int v = 0; v < allZLThirdIdList.size(); v++) {
            double Tweight3 = 0;
            int thirdId = allZLThirdIdList.get(v);
            String newWeight3 = mapperUtils.getEditableweightpsMapper().getWeightByNumber(thirdId, taskId);
            if (StringUtils.isBlank(newWeight3)) {
                Tweight3 = pointsCalculate.getPercentInstance(newWeight3);
            } else {
                String trueweight3 = parSystemMapper.getWeight3ByThirdId(thirdId);
                Tweight3 = pointsCalculate.getPercentInstance(trueweight3);
            }
            allZLweight3 += Tweight3;
        }
        List<Object> zlList = new ArrayList<>();
        for (int i = 0; i < allZLThirdIdList.size(); i++) {
            List<String> zlInnerResultBarCategories = new ArrayList<>();
            List<Integer> zlInnerResultBarData0 = new ArrayList<>();
            List<Double> zlInnerResultBarData1 = new ArrayList<>();
            List<Double> zlInnerResultBarData2 = new ArrayList<>();

            Map<String, Object> allThirdInfoMap = new HashMap<>();
            allThirdInfoMap.put("pName3", parSystemMapper.getName4ByName4Id(allZLThirdIdList.get(i)));
            zlResultBarCategories.add(parSystemMapper.getName4ByName4Id(allZLThirdIdList.get(i)));
            String newZLWeight3 = mapperUtils.getEditableweightpsMapper().getWeightByNumber(allZLThirdIdList.get(i), taskId);
            Double zlWeight3 = 0.0;
            if (StringUtils.isNotBlank(newZLWeight3)) {
                zlWeight3 = pointsCalculate.getPercentInstance(newZLWeight3) / allZLweight3;
            } else {
                zlWeight3 = pointsCalculate.getPercentInstance(parSystemMapper.getWeight3ByThirdId(allZLThirdIdList.get(i))) / allZLweight3;
            }
            allThirdInfoMap.put("weight3", df.format(zlWeight3));
            int zlProblemNum = parProblemCollectDetailMapper.getProblemNumByThirdId(checkId, allZLThirdIdList.get(i));
            int riskPointOver3Num = parProblemCollectDetailMapper.getRiskPointNumOver3ByThirdId(checkId, allZLThirdIdList.get(i), type3List);
            allThirdInfoMap.put("problemNum", zlProblemNum);
            allThirdInfoMap.put("riskOver3Num", riskPointOver3Num);
            zlResultBarData0.add(zlProblemNum);
            zlResultBarData1.add(riskPointOver3Num);
            String point3 = mapperUtils.getAllpointsaveMapper().getPointByCheckIdAndNumber(checkId, allZLThirdIdList.get(i));
            allThirdInfoMap.put("point3", point3);
            zlResultBarData2.add(Double.parseDouble(point3));
            zlPoint += Double.parseDouble(point3) * zlWeight3;
            List<ProblemCollectDetail> zlFourthInfoList = parProblemCollectDetailMapper.getZJFourthPoint(checkId, allZLThirdIdList.get(i));
            List<Object> zlFourthList = new ArrayList<>();
            for (int j = 0; j <= zlFourthInfoList.size(); j++) {
                Map<String, Object> allFourthInfoMap = new HashMap<>();
                allFourthInfoMap.put("pName4", parSystemMapper.getName4ByName4Id(zlFourthInfoList.get(j).getFourthId()));
                zlInnerResultBarCategories.add(parSystemMapper.getName4ByName4Id(zlFourthInfoList.get(j).getFourthId()));
                int zlProblemNum4 = parProblemCollectDetailMapper.getProblemNumByFourthId(checkId, zlFourthInfoList.get(j).getFourthId());
                allFourthInfoMap.put("problemNum", zlProblemNum4);
                zlInnerResultBarData0.add(zlProblemNum4);

                List<ProblemCollectDetail> sixthPoints = parProblemCollectDetailMapper.getsixthPoints(checkId, zlFourthInfoList.get(j).getFourthId());
                String pointName6Info = JSON.toJSONString(sixthPoints, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray sixthPointsArray = JSONArray.parseArray(pointName6Info);
                double calculatePoint6 = 0;
                double calculatePoint66 = 0;
                double calculateTruePoint = 0;
                for (int y = 0; y < sixthPointsArray.size(); y++) {
                    JSONObject sixPointObject = sixthPointsArray.getJSONObject(y);
                    int deductSixthId = sixPointObject.getIntValue("sixthId");
                    float deductPointsSumFloat = parProblemCollectDetailMapper.getdeductSum(checkId, deductSixthId);
                    double deductPointsSum = Double.valueOf(String.valueOf(deductPointsSumFloat));
                    double truePoint = Double.parseDouble(sixPointObject.getString("point6"));
                    if (truePoint <= deductPointsSum) {
                        calculatePoint66 = 0;
                    } else {
                        calculatePoint66 = truePoint - deductPointsSum;
                    }
                    calculateTruePoint += truePoint;
                    calculatePoint6 += calculatePoint66;
                }
                double noProblemPoint = 0;
                List<Object> noProblemSixthIdList = mapperUtils.getUncheckeditemsMapper().getNoProblemSixthId(checkId, zlFourthInfoList.get(j).getFourthId());
                String noProblemSixthIdInfo = JSON.toJSONString(noProblemSixthIdList, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray noProblemSixthArray = JSONArray.parseArray(noProblemSixthIdInfo);
                for (int m = 0; m < noProblemSixthArray.size(); m++) {
                    int noProblemSixthId = noProblemSixthArray.getIntValue(m);
                    double noProblem = Double.parseDouble(parSystemMapper.getPoint4ByPoint4Id(noProblemSixthId));
                    noProblemPoint += noProblem;
                }
                double checkItemPoint = (calculatePoint6 + noProblemPoint) / (calculateTruePoint + noProblemPoint) * 100;
                List<ProblemCollectDetail> checkItemCalcuList = parProblemCollectDetailMapper.getAllFourthInfo(checkId, zlFourthInfoList.get(j).getFourthId());
                String maxFourthRiskPoint = pointsCalculate.getMaxRiskPoint(checkItemCalcuList);
                int maxFourthRiskPointNum = parProblemCollectDetailMapper.getRiskPointCount(checkId, zlFourthInfoList.get(j).getFourthId(), maxFourthRiskPoint);
                double limitFourhPoint = Double.parseDouble((mapperUtils.getPointlimitMapper().getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint)) == null ? "100" : mapperUtils.getPointlimitMapper().getLimitPointByInfo(String.valueOf(maxFourthRiskPointNum), maxFourthRiskPoint));
                if (checkItemPoint > limitFourhPoint) {
                    checkItemPoint = limitFourhPoint;
                }
                String fourthPoint = df.format(checkItemPoint);
                zlInnerResultBarData2.add(Double.parseDouble(fourthPoint));
                double deductPoint = calculateTruePoint - calculatePoint6;
                String ideaPoint = df.format(calculateTruePoint + noProblemPoint);
                allFourthInfoMap.put("ideaPoint", ideaPoint);
                allFourthInfoMap.put("deductPoint", deductPoint);
                zlInnerResultBarData1.add(deductPoint);
                zlFourthList.add(allFourthInfoMap);
            }
            allThirdInfoMap.put("zlFourthList", zlFourthList);
            //质量分部工程分项评估柱状图
            try {
                HashMap<String, String> zlInnerResultBar = new HashMap<>();
                Map<String, Object> zlInnerResultBarInfos = new HashMap<>();
                Map<String, Object> zlInnerResultBarInfo0 = new HashMap<>();
                zlInnerResultBarInfo0.put("name", "不符合项数量");
                zlInnerResultBarInfo0.put("color", "rgb(75,67,232)");
                zlInnerResultBarInfo0.put("data", zlInnerResultBarData0);
                Map<String, Object> zlInnerResultBarInfo1 = new HashMap<>();
                zlInnerResultBarInfo1.put("name", "分项扣分");
                zlInnerResultBarInfo1.put("color", "red");
                zlInnerResultBarInfo1.put("data", zlInnerResultBarData1);
                Map<String, Object> zlInnerResultBarInfo2 = new HashMap<>();
                zlInnerResultBarInfo2.put("name", "分项最终得分");
                zlInnerResultBarInfo2.put("color", "#00CD00");
                zlInnerResultBarInfo2.put("data", zlInnerResultBarData2);
                Object[] zlInnerResultBarInfo = new Object[]{zlInnerResultBarInfo0, zlInnerResultBarInfo1, zlInnerResultBarInfo2};
                zlInnerResultBarInfos.put("series", zlInnerResultBarInfo);
                zlInnerResultBarInfos.put("subtitle", parSystemMapper.getName4ByName4Id(allZLThirdIdList.get(i)) + ":" + df.format(zlPoint));
                zlInnerResultBarInfos.put("title", "分部工程评估结果");
                zlInnerResultBarInfos.put("categories", zlInnerResultBarCategories);
                zlInnerResultBar.put("dataSet", JSON.toJSONString(zlInnerResultBarInfos));
                zlInnerResultBar.put("width", "718");
                zlInnerResultBar.put("height", "468");
                zlInnerResultBar.put("index", "7");
                String zlInnerResultBarPic = HttpUtil.post("http://localhost:3000/highcharts", zlInnerResultBar, "utf-8");
                allThirdInfoMap.put("zlInnerResultBarPic", zlInnerResultBarPic.substring(22));
            } catch (Exception e) {
                e.printStackTrace();
            }
            zlList.add(allThirdInfoMap);
        }
        dataMap.put("zlList", zlList);
        dataMap.put("zlPoint", df.format(zlPoint));
        //质量分项评估柱状图
        try {
            HashMap<String, String> zlResultBar = new HashMap<>();
            Map<String, Object> zlResultBarInfos = new HashMap<>();
            Map<String, Object> zlResultBarInfo0 = new HashMap<>();
            zlResultBarInfo0.put("name", "不符合项数量");
            zlResultBarInfo0.put("color", "rgb(75,67,232)");
            zlResultBarInfo0.put("data", zlResultBarData0);
            Map<String, Object> zlResultBarInfo1 = new HashMap<>();
            zlResultBarInfo1.put("name", "3级以上问题数量");
            zlResultBarInfo1.put("color", "red");
            zlResultBarInfo1.put("data", zlResultBarData1);
            Map<String, Object> zlResultBarInfo2 = new HashMap<>();
            zlResultBarInfo2.put("name", "分项得分");
            zlResultBarInfo2.put("color", "#00CD00");
            zlResultBarInfo2.put("data", zlResultBarData2);
            Object[] zlResultBarInfo = new Object[]{zlResultBarInfo0, zlResultBarInfo1, zlResultBarInfo2};
            zlResultBarInfos.put("series", zlResultBarInfo);
            zlResultBarInfos.put("title", "质量隐患评估结果");
            zlResultBarInfos.put("subtitle", "质量隐患得分:" + df.format(zlPoint));
            zlResultBarInfos.put("categories", zlResultBarCategories);
            zlResultBar.put("dataSet", JSON.toJSONString(zlResultBarInfos));
            zlResultBar.put("width", "718");
            zlResultBar.put("height", "468");
            zlResultBar.put("index", "7");
            String zlResultBarPic = HttpUtil.post("http://localhost:3000/highcharts", zlResultBar, "utf-8");
            dataMap.put("zlResultBarPic", zlResultBarPic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        List<String> zlAllResultBarCategories = new ArrayList<>();
        List<Double> zlAllResultBarData0 = new ArrayList<>();
        List<Double> zlAllResultBarData1 = new ArrayList<>();
        List<Double> zlAllResultBarData2 = new ArrayList<>();
        List<String> zlAllResultBarData3 = new ArrayList<>();

        List<String> glResultBarCategories = new ArrayList<>();
        List<Integer> glResultBarData0 = new ArrayList<>();
        //List<Integer> glResultBarData1=new ArrayList<>();
        List<Double> glResultBarData2 = new ArrayList<>();

        List<Integer> allGLFourthIdList = parProblemCollectDetailMapper.getAllFourthIdByNum(checkId, 736);
        List<Object> glList = new ArrayList<>();
        for (int i = 0; i < allGLFourthIdList.size(); i++) {
            Map<String, Object> glInfoMap = new HashMap<>();
            glInfoMap.put("no", i + 1);
            glInfoMap.put("pName4", parSystemMapper.getName4ByName4Id(allGLFourthIdList.get(i)));
            glResultBarCategories.add(parSystemMapper.getName4ByName4Id(allGLFourthIdList.get(i)));
            zlAllResultBarCategories.add(parSystemMapper.getName4ByName4Id(allGLFourthIdList.get(i)));
            zlAllResultBarData0.add(Double.parseDouble(scslPoint));
            zlAllResultBarData1.add(zlPoint);
            int glProblemNum4 = parProblemCollectDetailMapper.getProblemNumByFourthId(checkId, allGLFourthIdList.get(i));
            glResultBarData0.add(glProblemNum4);
            glInfoMap.put("problemNum", glProblemNum4);
            String point4 = mapperUtils.getAllpointsaveMapper().getPointByCheckIdAndNumber(checkId, allGLFourthIdList.get(i));
            glInfoMap.put("point4", point4);
            zlAllResultBarData2.add(Double.parseDouble(point4));
            glResultBarData2.add(Double.parseDouble(point4));
            String allOverPoint = df.format(Double.parseDouble(scslPoint) * 0.3 + zlPoint * 0.4 + Double.parseDouble(point4) * 0.3);
            glInfoMap.put("allOverPoint", allOverPoint);
            zlAllResultBarData3.add(allOverPoint);
            glList.add(glInfoMap);
        }
        dataMap.put("glList", glList);
        //管理行为分项评估柱状图
        try {
            HashMap<String, String> glResultBar = new HashMap<>();
            Map<String, Object> glResultBarInfos = new HashMap<>();
            Map<String, Object> glResultBarInfo0 = new HashMap<>();
            glResultBarInfo0.put("name", "不符合项数量");
            glResultBarInfo0.put("color", "rgb(75,67,232)");
            glResultBarInfo0.put("data", glResultBarData0);
            /*Map<String,Object> glResultBarInfo1=new HashMap<>();
            glResultBarInfo1.put("name","3级以上风险数量");
            glResultBarInfo1.put("color","red");
            glResultBarInfo1.put("data",glResultBarData1);*/
            Map<String, Object> glResultBarInfo2 = new HashMap<>();
            glResultBarInfo2.put("name", "分项得分");
            glResultBarInfo2.put("color", "#00CD00");
            glResultBarInfo2.put("data", glResultBarData2);
            Object[] glResultBarInfo = new Object[]{glResultBarInfo0, glResultBarInfo2};
            glResultBarInfos.put("series", glResultBarInfo);
            glResultBarInfos.put("title", "管理行为评估结果");
            glResultBarInfos.put("categories", glResultBarCategories);
            glResultBar.put("dataSet", JSON.toJSONString(glResultBarInfos));
            glResultBar.put("width", "718");
            glResultBar.put("height", "468");
            glResultBar.put("index", "4");
            String glResultBarPic = HttpUtil.post("http://localhost:3000/highcharts", glResultBar, "utf-8");
            dataMap.put("glResultBarPic", glResultBarPic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        //综合评估柱状图
        try {
            HashMap<String, String> zlAllResultBar = new HashMap<>();
            Map<String, Object> zlAllResultBarInfos = new HashMap<>();
            Map<String, Object> zlAllResultBarInfo0 = new HashMap<>();
            zlAllResultBarInfo0.put("name", "实测实量(30%)");
            zlAllResultBarInfo0.put("color", "red");
            zlAllResultBarInfo0.put("data", zlAllResultBarData0);
            Map<String, Object> zlAllResultBarInfo1 = new HashMap<>();
            zlAllResultBarInfo1.put("name", "质量风险(40%)");
            zlAllResultBarInfo1.put("color", "rgb(75,67,232)");
            zlAllResultBarInfo1.put("data", zlAllResultBarData1);
            Map<String, Object> zlAllResultBarInfo2 = new HashMap<>();
            zlAllResultBarInfo2.put("name", "管理行为(30%)");
            zlAllResultBarInfo2.put("color", "rgb(232,137,31)");
            zlAllResultBarInfo2.put("data", zlAllResultBarData2);
            Map<String, Object> zlAllResultBarInfo3 = new HashMap<>();
            zlAllResultBarInfo3.put("name", "综合评分");
            zlAllResultBarInfo3.put("color", "rgb(190,190,190)");
            zlAllResultBarInfo3.put("data", zlAllResultBarData3);
            Object[] zlAllResultBarInfo = new Object[]{zlAllResultBarInfo0, zlAllResultBarInfo1, zlAllResultBarInfo2};
            zlAllResultBarInfos.put("series", zlAllResultBarInfo);
            zlAllResultBarInfos.put("title", "质量风险评估结果");
            zlAllResultBarInfos.put("categories", zlAllResultBarCategories);
            zlAllResultBar.put("dataSet", JSON.toJSONString(zlAllResultBarInfos));
            zlAllResultBar.put("width", "718");
            zlAllResultBar.put("height", "468");
            zlAllResultBar.put("index", "4");
            String zlAllResultBarPic = HttpUtil.post("http://localhost:3000/highcharts", zlAllResultBar, "utf-8");
            dataMap.put("zlAllResultBarPic", zlAllResultBarPic.substring(22));
        } catch (Exception e) {
            e.printStackTrace();
        }

        //质量问题汇总表
        List<ProblemCollectDetail> zlProblemInfo = parProblemCollectDetailMapper.getAllInfoByFirstId(checkId, 628);
        List<Object> zlProblemList = new ArrayList<>();
        for (int i = 0; i < zlProblemInfo.size(); i++) {
            Map<String, Object> zlProblemMap = new HashMap<>();
            zlProblemMap.put("no", i + 1);
            zlProblemMap.put("pName3", zlProblemInfo.get(i).getpName3());
            zlProblemMap.put("pName4", zlProblemInfo.get(i).getpName4());
            if (zlProblemInfo.get(i).getIsRemark().equals("N")) {
                zlProblemMap.put("problemDescription", zlProblemInfo.get(i).getProblemDescription());
            } else if (zlProblemInfo.get(i).getIsRemark().equals("Y")) {
                zlProblemMap.put("problemDescription", zlProblemInfo.get(i).getRemark());
            }
            zlProblemMap.put("riskPoint", zlProblemInfo.get(i).getRiskPoint());
            zlProblemList.add(zlProblemMap);
        }
        dataMap.put("zlProblemList", zlProblemList);

        List<Object> glProblemList = new ArrayList<>();
        for (int i = 0; i < allGLFourthIdList.size(); i++) {
            Map<String, Object> glProblemMap = new HashMap<>();
            glProblemMap.put("pName4", parSystemMapper.getName4ByName4Id(allGLFourthIdList.get(i)));
            List<ProblemCollectDetail> allGLFourthProblemInfo = parProblemCollectDetailMapper.getAllFourthInfo(checkId, allGLFourthIdList.get(i));
            List<Object> glProblemInnerList = new ArrayList<>();
            for (int j = 0; j < allGLFourthProblemInfo.size(); j++) {
                Map<String, Object> glProblemInnerMap = new HashMap<>();
                glProblemInnerMap.put("no", j + 1);
                glProblemInnerMap.put("pName6", allGLFourthProblemInfo.get(j).getpName6());
                if (allGLFourthProblemInfo.get(j).getIsRemark().equals("N")) {
                    glProblemInnerMap.put("problemDescription", allGLFourthProblemInfo.get(j).getProblemDescription());
                } else if (allGLFourthProblemInfo.get(j).getIsRemark().equals("Y")) {
                    glProblemInnerMap.put("problemDescription", allGLFourthProblemInfo.get(j).getRemark());
                }
                glProblemInnerMap.put("riskPoint", allGLFourthProblemInfo.get(j).getRiskPoint());
                glProblemInnerList.add(glProblemInnerMap);
            }
            glProblemList.add(glProblemMap);
        }
        dataMap.put("glProblemList", glProblemList);

        //第三部分，质量问题各分项检查情况
        List<Integer> pName1Info = parProblemCollectDetailMapper.getAllName1Id(checkId);
        String name1 = JSON.toJSONString(pName1Info, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
        JSONArray name1Array = JSONArray.parseArray(name1);
        String section2pName1 = "";
        List<Object> section2List = new ArrayList<Object>();
        for (int b = 0; b < name1Array.size(); b++) {
            Map<String, Object> section2Name1Map = new HashMap<String, Object>();
            List<Object> section2name1List = new ArrayList<Object>();
            String section2name1 = parSystemMapper.getName4ByName4Id(name1Array.getIntValue(b));
            if (section2name1.equals("安全检查")||section2name1.equals("新安全检查")) {
                section2pName1 = "安全问题";
            } else if (section2name1.equals("质量检查")||section2name1.equals("新质量检查")) {
                section2pName1 = "质量问题";
            } else if (section2name1.equals("管理行为")||section2name1.equals("新管理行为")) {
                section2pName1 = "管理体系及管理动作";
            }
            section2Name1Map.put("section2pName1", section2pName1);
            List<Integer> section2Name4Info = parProblemCollectDetailMapper.getAllName4ByName1(checkId, section2name1);
            String section2Name44 = JSON.toJSONString(section2Name4Info, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
            JSONArray section2Name4Array = JSONArray.parseArray(section2Name44);
            for (int w = 0; w < section2Name4Array.size(); w++) {
                Map<String, Object> section2Name4Map = new HashMap<String, Object>();
                List<Object> section2Name4List = new ArrayList<Object>();
                int section2Name4Id = section2Name4Array.getIntValue(w);
                String section2Name4 = parSystemMapper.getName4ByName4Id(section2Name4Id);
                List<ProblemCollectDetail> section2Name6Info = parProblemCollectDetailMapper.getAllName6InfoByName4(checkId, section2Name4Id, section2name1);
                String section2Name66 = JSON.toJSONString(section2Name6Info, SerializerFeature.WriteMapNullValue, SerializerFeature.DisableCircularReferenceDetect);
                JSONArray section2Name6Array = JSONArray.parseArray(section2Name66);
                for (int c = 0; c < section2Name6Array.size(); c++) {
                    Map<String, Object> section2Name6Map = new HashMap<String, Object>();
                    List<Object> picList = new ArrayList<Object>();
                    JSONObject section2Name6Object = section2Name6Array.getJSONObject(c);
                    section2Name6Map.put("section2pName6No", c + 1);
                    section2Name6Map.put("section2pName6", section2Name6Object.getString("pName6"));
                    section2Name6Map.put("section2pName5", section2Name6Object.getString("pName5"));
                    section2Name6Map.put("section2RiskLevel", section2Name6Object.getString("riskPoint"));
                    section2Name6Map.put("section2CheckPart", section2Name6Object.getString("checkPart"));
                    section2Name6Map.put("section2ProblemNum", section2Name6Object.getString("problemQua"));
                    if (section2Name6Object.getString("isRemark").equals("N")) {
                        section2Name6Map.put("section2problemDescription", section2Name6Object.getString("problemDescription"));
                    } else if (section2Name6Object.getString("isRemark").equals("Y")) {
                        section2Name6Map.put("section2problemDescription", section2Name6Object.getString("remark"));
                    }
                    section2Name6Map.put("section2normsProvison", section2Name6Object.getString("normsProvison"));
                    section2Name6Map.put("section2suggestion", section2Name6Object.getString("suggestion"));
                    String section2picPath = section2Name6Object.getString("picPath");
                    String picName = section2Name6Object.getString("picName");
                    JSONArray ja = JSONArray.parseArray(picName);
                    if (ja.size() == 0) {
                        //String s = MDoc.getImageStr("C:\\Users\\96500\\Desktop\\20190329183836002.png");
                        String s = MDoc.getImageStr("D:\\whutServer\\generatedCharts\\noPic.png");
                        picList.add(s);
                    } else {
                        for (int o = 0; o < ja.size(); o++) {
                            String s = "";
                            if ("prod".equals(profiles.getActives())) {
                                s = MDoc.getImageStr(section2picPath + ja.getString(o));
                            }

                            //String s = MDoc.getImageStr("C:\\Users\\96500\\Desktop\\20190329183836002.png");
                            picList.add(s);
                        }
                    }
                    section2Name6Map.put("picList", picList);
                    section2Name4List.add(section2Name6Map);

                }
                section2Name4Map.put("section2pName4", section2Name4);
                section2Name4Map.put("section2Name4List", section2Name4List);
                section2name1List.add(section2Name4Map);
            }
            section2Name1Map.put("section2Name1List", section2name1List);
            section2List.add(section2Name1Map);
        }
        dataMap.put("section2List", section2List);

        //改进建议
        List<Summary> glSummaryInfo = mapperUtils.getSummaryMapper().getSummaryInfo(checkId, 628);
        List<Object> glSummaryList = new ArrayList<>();
        for (int i = 0; i < glSummaryInfo.size(); i++) {
            Map<String, Object> glSummaryMap = new HashMap<>();
            glSummaryMap.put("no", i + 1);
            glSummaryMap.put("pName4", parSystemMapper.getName4ByName4Id(glSummaryInfo.get(i).getFourthId()));
            glSummaryMap.put("summary", glSummaryInfo.get(i).getSummary() == null ? "" : glSummaryInfo.get(i).getSummary());
            glSummaryList.add(glSummaryMap);
        }
        dataMap.put("glSummaryList", glSummaryList);

        List<Object> zlSummaryList = new ArrayList<>();
        for (int i = 0; i < allZLThirdIdList.size(); i++) {
            Map<String, Object> zlSummaryMap = new HashMap<>();
            zlSummaryMap.put("no", i + 1);
            zlSummaryMap.put("pName3", parSystemMapper.getName4ByName4Id(allZLThirdIdList.get(i)));
            List<Summary> allSummaryByThirdId = mapperUtils.getSummaryMapper().getAllSummaryByThirdId(checkId, allZLThirdIdList.get(i));
            if (allSummaryByThirdId.size() == 0) {
                zlSummaryMap.put("summary", "");
            } else {
                String summary = "";
                for (int j = 0; j < allSummaryByThirdId.size(); j++) {
                    summary += (j + 1) + "、" + allSummaryByThirdId.get(j).getSummary() + ";";
                }
                zlSummaryMap.put("summary", summary);
            }
            zlSummaryList.add(zlSummaryMap);
        }
        dataMap.put("zlSummaryList", zlSummaryList);
        MDoc mdoc = new MDoc();
        String path = FileUtil.getServerFolderPath();
        File f1 = new File(path, "doc");
        if (!f1.exists()) {
            f1.mkdirs();
        }
        mdoc.createDoc(dataMap, path + "\\doc\\" + String.valueOf(dataMap.get("projectName")).replace('#', '号') + "质量可视化报告" + dataMap.get("fileDate") + ".doc", "ftl\\zlVisible.ftl");
        MDoc.docToDocx("D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + String.valueOf(dataMap.get("projectName")).replace('#', '号') + "质量可视化报告" + dataMap.get("fileDate") + ".doc", "D:\\whutServer\\apache-tomcat-8.5.41\\webapps\\ROOT\\doc\\" + String.valueOf(dataMap.get("projectName")).replace('#', '号') + "质量可视化报告" + dataMap.get("fileDate") + ".doc");
        String result = urlProperties.getAddress() + "/doc/" + String.valueOf(dataMap.get("projectName")).replace('#', '号') + "质量可视化报告" + dataMap.get("fileDate") + ".doc";
        return result;
    }
}
